package com.jack.house.entity;

import com.baomidou.mybatisplus.annotation.TableName;
import com.jack.house.BaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;

/**
 * <p>
 * 支持地址
 * </p>
 *
 * @author jack
 * @since 2020-04-24
 */
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("support_address")
@ApiModel(value="SupportAddress对象", description="支持地址")
public class SupportAddress extends BaseEntity {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "上一级行政单位名")
    private String belongTo;

    @ApiModelProperty(value = "行政单位英文名缩写")
    private String enName;

    @ApiModelProperty(value = "行政单位中文名")
    private String cnName;

    @ApiModelProperty(value = "行政级别 市-city 地区-region")
    private String level;

    @ApiModelProperty(value = "百度地图经度")
    private Double baiduMapLng;

    @ApiModelProperty(value = "百度地图纬度")
    private Double baiduMapLat;

    /**
     * 行政级别定义
     */
    public enum Level {
        CITY("city"),
        REGION("region");

        private String value;

        Level(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }

        public static Level of(String value) {
            for (Level level : Level.values()) {
                if (level.getValue().equals(value)) {
                    return level;
                }
            }

            throw new IllegalArgumentException();
        }
    }
}
